WPS 基础接口 > 文字 API 参考 > Application > 属性 > Application.Documents 属性
返回一个 Documents 集合,该集合代表所有打开的文档。只读。

语法

表达式.Documents

表达式   一个代表 Application 对象的变量。

说明

有关返回集合中单个成员的信息,请参阅 返回集合中的对象。

示例

本示例根据 Normal 模板新建一篇文档,然后显示“另存为”对话框。

示例代码
Documents.Add().Save()

如果文档在上次保存后进行了修改,本示例将保存该文档。

示例代码
for(let i=1; i <= Documents.Count; i++) {
if(Documents.Item(i).Saved == false) {
    Documents.Item(i).Save()
    }
}

本示例先将文档的左右边距设置为 0.5 英寸,然后打印所有打开的文档。

示例代码
for(let i=1; i <= Documents.Count; i++) {
    Documents.Item(i).PageSetup.LeftMargin = InchesToPoints(0.5)
    Documents.Item(i).ageSetup.RightMargin = InchesToPoints(0.5)
    Documents.Item(i).PrintOut()
}

本示例以只读方式打开文档 Doc.doc。

示例代码
Documents.Open("C:\\Files\\Doc.doc",true)


请参阅